package com.wx.clazzloader.hotreload;

import com.wx.clazzloader.hotreload.clazz.Hello;
import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @description:
 * @author: wangxun
 * @createDate: 2021/12/28
 * @version: 1.0
 */
@Slf4j
public class TestMain {
    public static void main(String[] args) throws InterruptedException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        MyContainer container = MyContainer.getInstance();


        for (;;){
            Object hello = container.getObject("Hello");
            Method sayHi = hello.getClass().getMethod("sayHi");
            sayHi.invoke(hello);

            Thread.sleep(2000);
        }


    }
}
